package com.maket.scxx.service.impl;

import java.util.List;

import com.maket.scxx.feign.GetCodeFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.maket.scxx.mapper.CkWarehouseMapper;
import com.maket.scxx.domain.CkWarehouse;
import com.maket.scxx.service.ICkWarehouseService;

/**
 * 仓库定义Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-06-24
 */
@Service
public class CkWarehouseServiceImpl implements ICkWarehouseService 
{
    @Autowired
    private CkWarehouseMapper ckWarehouseMapper;

    /**
     * 查询仓库定义
     * 
     * @param ckCode 仓库定义主键
     * @return 仓库定义
     */
    @Override
    public CkWarehouse selectCkWarehouseByCkCode(String ckCode)
    {
        return ckWarehouseMapper.selectCkWarehouseByCkCode(ckCode);
    }

    /**
     * 查询仓库定义列表
     * 
     * @param ckWarehouse 仓库定义
     * @return 仓库定义
     */
    @Override
    public List<CkWarehouse> selectCkWarehouseList(CkWarehouse ckWarehouse)
    {
        return ckWarehouseMapper.selectCkWarehouseList(ckWarehouse);
    }

    /**
     * 新增仓库定义
     * 
     * @param ckWarehouse 仓库定义
     * @return 结果
     */
    @Autowired
    private GetCodeFeign getCodeFeign;
    @Override
    public int insertCkWarehouse(CkWarehouse ckWarehouse)
    {
        String code = getCodeFeign.getUser(6);
        ckWarehouse.setCkCode(code);
        return ckWarehouseMapper.insertCkWarehouse(ckWarehouse);
    }

    /**
     * 修改仓库定义
     * 
     * @param ckWarehouse 仓库定义
     * @return 结果
     */
    @Override
    public int updateCkWarehouse(CkWarehouse ckWarehouse)
    {
        return ckWarehouseMapper.updateCkWarehouse(ckWarehouse);
    }

    /**
     * 批量删除仓库定义
     * 
     * @param ckCodes 需要删除的仓库定义主键
     * @return 结果
     */
    @Override
    public int deleteCkWarehouseByCkCodes(String[] ckCodes)
    {
        return ckWarehouseMapper.deleteCkWarehouseByCkCodes(ckCodes);
    }

    /**
     * 删除仓库定义信息
     * 
     * @param ckCode 仓库定义主键
     * @return 结果
     */
    @Override
    public int deleteCkWarehouseByCkCode(String ckCode)
    {
        return ckWarehouseMapper.deleteCkWarehouseByCkCode(ckCode);
    }
}
